$(function () {
    findAll()
})

function findAll() {
    let data = myAjax("/news", {}, "get");
    setNewsContentData(data.newsContentList);
}

function setNewsContentData(data) {
    let html = '';
    for (let i = 0; i < data.length; i++) {
    html+='<div>\n' +
        '                    <div>\n' +
        '                        <div><img src="'+data[i].imgHref+'" height="16" width="16"/></div>\n' +
        '                        <div onclick="gotoDetailPage('+data[i].id+')">'+data[i].title+'</div>\n' +
        '                    </div>\n' +
        '                    <div>'+data[i].createTime+'</div>\n' +
        '                </div>';
    }
    $("#newsHtml").html(html);
}
function gotoDetailPage(id) {
    sessionStorage.setItem("newsId",id);
    window.open("/html/detail.html")
}